<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>认证</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <script type="text/javascript" src="./script/api.js"></script>
    <script type="text/javascript" src="./script/aui-tab.js" ></script>
    <link rel="stylesheet" type="text/css" href="./css/aui-slide.css" />
    <script type="text/javascript" src="./script/aui-slide.js"></script>
    <script type="text/javascript" src="./script/base.js"></script>
    <script type="text/javascript" src="./script/doT.min.js"></script>
    <script type="text/javascript" src="./script/jquery-3.2.0.js"></script>
    <script type="text/javascript">
        function closeWin(){
            api.closeWin({
            });
        };
    </script>
</head>
<body>

<div id="list"></div>
</body>

<script type="text/template" id="template">
    <div class="aui-content licai-authentication">
        <ul class="aui-list aui-list-in">
            <i></i>
            <h3><span class="fa fa-address-card-o"></span>个人信息</h3>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">用户名</div>
                    <div class="aui-list-item-right name">{{=it.real_name}}</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">性别</div>
                    <div class="aui-list-item-right">{{? it.sex == 1}}男{{??}}女{{?}}</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">手机号</div>
                    <div class="aui-list-item-right phonenumber">{{=it.mobile}}</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">最高学历</div>
                    <div class="aui-list-item-right">{{=it.graduation}}</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">婚姻状况</div>
                    <div class="aui-list-item-right">{{=it.marriage}}</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">房产状况</div>
                    <div class="aui-list-item-right">{{? it.hashouse == 1}}有{{??}}无{{?}}</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">车辆状况</div>
                    <div class="aui-list-item-right">{{? it.hascar == 1}}有{{??}}无{{?}}</div>
                </div>
            </li>
        </ul>
        <ul class="aui-list aui-list-in">
            <i></i>
            <h3><span class="fa fa-briefcase"></span>工作状况</h3>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">工作行业</div>
                    <div class="aui-list-item-right work">{{=it.workinfo.officedomain}}</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">工作城市</div>
                    <div class="aui-list-item-right work">{{=it.workinfo.region_province}} {{=it.workinfo.region_city}}</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">工作时间</div>
                    <div class="aui-list-item-right work">{{=it.workinfo.workyears}}</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">工作收入</div>
                    <div class="aui-list-item-right work">{{=it.workinfo.salary}}</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">信用额度</div>
                    <div class="aui-list-item-right">￥{{=it.quota}}</div>
                </div>
            </li>
        </ul>
        <ul class="aui-list aui-list-in">
            <i></i>
            <h3><span class="fa fa-calculator"></span>借款信息</h3>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">借款金额</div>
                    <div class="aui-list-item-right" id="borrow_amount">￥20.00万</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">借款期限</div>
                    <div class="aui-list-item-right" id="limit"></div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">借款利率</div>
                    <div class="aui-list-item-right" id="rate"></div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">还款方式</div>
                    <div class="aui-list-item-right" id="loantype"></div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">抵押措施</div>
                    <div class="aui-list-item-right">有</div>
                </div>
            </li>
        </ul>
        <ul class="aui-list aui-list-in">
            <i></i>
            <h3><span class="fa fa-gears"></span>其他审核资料</h3>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">身份证信息</div>
                    <div class="aui-list-item-right"><span class="fa fa-check-circle-o"></span>已认证</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">银行卡信息</div>
                    <div class="aui-list-item-right"><span class="fa fa-check-circle-o"></span>已认证</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">信用报告</div>
                    <div class="aui-list-item-right"><span class="fa fa-check-circle-o"></span>已认证</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">收入证明</div>
                    <div class="aui-list-item-right"><span class="fa fa-check-circle-o"></span>已认证</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">共借人信息</div>
                    <div class="aui-list-item-right"><span class="fa fa-check-circle-o"></span>已认证</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">车辆情况</div>
                    <div class="aui-list-item-right"><span class="fa fa-check-circle-o"></span>已认证</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">房产情况</div>
                    <div class="aui-list-item-right"><span class="fa fa-check-circle-o"></span>已认证</div>
                </div>
            </li>
        </ul>
    </div>
</script>


<script type="text/javascript">
    apiready = function(){

        var id = api.pageParam.id;
        load_list(id);
    }

    // 加载列表
    function load_list(id) {

        api.showProgress({
            style: 'default',
            animationType: 'fade',
            title: '努力加载中...',
            text: '先喝杯茶...',
            modal: false
        });

        api.ajax({
            url: webAddress+'/index.php?ctl=app_deal&act=deal&id='+id,
            method: 'get',
        },function(ret, err){

            if (ret) {

                if (ret.status == 0) {
                    alert(ret.info);
                }else {
                    // alert( JSON.stringify( ret ) );
                    api.hideProgress();

                    var work = 1;
                    // alert(ret.u_info.workinfo);
                    if(ret.u_info.workinfo == false){
                        work = 0;
                    }
                    updateList(ret.u_info, ret.deal, work);
                }
            } else {
                // alert( JSON.stringify( err ) );
                alert(err.msg);
                api.hideProgress();
                api.closeWin({
                });
            }
        });
    }

    // doT
    function updateList(data, deal, work){

        var template = $api.byId('template');
        var dotFn = doT.template(template.innerHTML);
        var html = dotFn(data);
        var list = $api.byId('list');
        $api.html(list, html); 
        $('#borrow_amount').text('￥'+parseInt(deal.borrow_amount)/10000+'万');
        $('#limit').text(deal.repay_time+'个月');
        $('#rate').text(deal.rate+' %');
        var loantype = deal.loantype;
        var str = '';
        switch (parseInt(loantype))
        {
            case 0:
            str = '等额本息';
            break;
            case 1:
            str = '每月付息，到期还本';
            break;
            case 2:
            str = '到期还本息';
            break;
            case 3:
            str = '先息后本';
            break;
        }
        $('#loantype').text(str);
        $(".name").each(function(){
            var tmp = hidden_name($(this).text());
            $(this).text(tmp);
        });
        $(".phonenumber").each(function(){
            var tmp = hidden_phonenumber($(this).text());
            $(this).text(tmp);
        });
        // $(".money").each(function(){
        //     // alert($(this).text());
        //     var tmp = outputmoney($(this).text());
        //     $(this).text(tmp);
        // });
        // document.getElementById('num').innerHTML = num;

        if (work == 0) {
            $(".work").text('无');
        }
    }


</script>
</html>